[ 

	var(
		'code'=error_code,
		'msg'=error_msg
		);
	
	
	var('errorInline') = ($msg >> 'at: include with params:');
	
	
	if:error_code == error_code_nopermission; 
			auth_prompt: -noabort, -noresponse; 
	/if; 
	
	
	
	
	var:'DEBUG_LEVEL' = lasso_errorreporting; 
	
	if:$DEBUG_LEVEL != 'full'; 
			log_detail: 'Script Error: ' + error_code + ' ' + error_msg;
	/if; 
	
	
	if($errorInline); 
		// only do this for inline errors 
	/if; 
	 
	if(!$errorInline); 
		// only do this for full-page errors 
	/if;


	if(!$errorInline);                                    // only for full-page 
		var('statuses') = map( 
				  0    =    '200 Okay',                    // just in case 
			-9963    =    '401 Unauthorized', 
			-9964    =    '401 Unauthorized', 
			-9961    =    '403 Forbidden', 
			-9967    =    '404 Not Found', 
			-9984    =    '404 Not Found' 
		); 
	 
		var('status') = $statuses->find($code); 
		!$status ? $status = '500 Internal Server Error';  // default to 500 
	 
		$__http_header__ = string_replaceregexp( 
			$__http_header__, 
			-find='(^HTTP\\S+)\\s+.*?\r\n', 
			-replace='\\1 ' + $status + '\r\n' 
		); 
	/if;


	// log error to error database 
	var('desc') = ('[' + client_url + '] ' + error_code + ': ' + error_msg); 
	log_critical($desc);

] 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Style-Type" content="text/css">
		<meta http-equiv="Content-Script-Type" content="text/javascript">
		<link rel="stylesheet" href="/_Makerator/css/blueprintcss/screen.css" type="text/css" media="screen, projection">
		<link rel="stylesheet" href="/_Makerator/css/blueprintcss/print.css" type="text/css" media="print">
<script type="text/javascript" src="/_Makerator/jquery/jquery-1.2.3.min.js"></script> <script type="text/javascript" src="/_Makerator/jquery/superfish.js"></script> 
		<link href="/_Makerator/css/site.css" rel="stylesheet" type="text/css">
		<link href="/_Makerator/css/admin.css" rel="stylesheet" type="text/css">
		<title>
			[ if: $DEBUG_LEVEL != 'none'; 'Error: '; error_code; else; 'Oops!'; /if; ] | Makerator 
		</title>
	</head>
	<body>
		[/*$show_admin_content && $admin_toolbar->size > 8 ? $admin_toolbar*/] 
		<div class="container">
			<h1 class="header column  span-24" title="Sweet.">
				<a href="/" id="logo">
					<strong>
						Makerator 
					</strong>
				</a>
			</h1>
		</div>
		<div class="container">
			<div class="column span-24 prepend-0 append-0 first last">
				<h1>
					[ if: $DEBUG_LEVEL != 'none'; 'Error: '; error_code; else; 'Oops!'; /if; ] 
				</h1>
				<div class="content">
	[ if:$DEBUG_LEVEL == 'none'; ' 
	<div class="error">
		An error occurred while processing your request. 
	</div>
	'; else;
	
	if:lasso_currentAction == 'add'; error_addError; 
	else:lasso_currentAction == 'update'; error_updateError; 
	else:lasso_currentAction == 'delete'; 
	error_deleteError; 
	else:(lasso_currentAction == 'search') 
	|| (lasso_currentAction == 'findall'); error_noRecordsFound; 
	else; '
	<div class="error">
		A mysterious error occurred while processing &ldquo;<code>' response_filepath '</code>&rdquo; 
	</div>';
	
	
	 /if; ] 
	<table class="errorreport">
		<tr>
			<th>
				Error Message: 
			</th>
			<td class="code">
				[if:error_currentError != '']
				
				[
					var('the_error' = (error_currentError->split('\r')));
					
					var('a_errorLine');
					iterate($the_error, $a_errorLine);
					
						var('this' = $a_errorLine->split(':'));
						$this->sort(false);
						iterate($this, local('x'));
						
								select(true);
								
								case(#x->endswith('at'));
										'<br><strong>At:&nbsp;</strong>';
								case;
										'<code>'#x'</code>';
								/select;
						/iterate;
					/iterate;
					
				]
				
				
				[else]--[/if] 
			</td>
		</tr>
		<tr>
			<th>
				Error Code: 
			</th>
			<td class="code">
				[error_currentError: -errorCode] 
			</td>
		</tr>
		<tr>
			<th>
				Action: 
			</th>
			<td class="code">
				[lasso_currentAction] 
			</td>
		</tr>
		<tr>
			<th>
				Database: 
			</th>
			<td class="code">
				[if:database_name != ''][database_name][else]--[/if] 
			</td>
		</tr>
		<tr>
			<th>
				Table/Layout: 
			</th>
			<td class="code">
				[if:layout_name != ''][layout_name][else]--[/if] 
			</td>
		</tr>
		<tr>
			<th>
				Response: 
			</th>
			<td class="code">
				[if:response_filepath != ''][response_filepath][else]--[/if] 
			</td>
		</tr>
		[if:(client_username != '') || (client_password != '')] 
		[/if] [if:(client_username != '')] 
		<tr>
			<th>
				User Name: 
			</th>
			<td class="code">
				[client_username] 
			</td>
		</tr>
		[/if] [if:(client_password != '')] 
		<tr>
			<th>
				Password: 
			</th>
			<td class="code">
				(not shown) 
			</td>
		</tr>
		[/if] [if:(lasso_currentAction == 'add') || (lasso_currentAction == 'update') || (lasso_currentAction == 'search') || (lasso_currentAction == 'findall')] [if:(lasso_version: -lassoedition) >> 'Publisher'] [else] [search_args] [if:Loop_Count == 1] 
		[/if] 
		<tr>
			<th>
				[search_fielditem]: 
			</th>
			<td class="code">
				[if:(lasso_currentAction == 'search') || (lasso_currentAction == 'findall')][search_opitem] [/if]&quot;[search_valueitem]&quot; 
			</td>
		</tr>
		[/search_args] [if:(lasso_currentAction == 'search') || (lasso_currentAction == 'findall')] [sort_args] [if:Loop_Count == 1] 
		[/if] [if:sort_fielditem != 'unsorted'] 
		<tr>
			<th>
				[sort_fielditem]: 
			</th>
			<td class="code">
				sorted by [sort_orderitem] order 
			</td>
		</tr>
		[/if] [/sort_args] [/if] 
		<tr>
			<th>
				Logical Operator: 
			</th>
			<td class="code">
				[operator_logicalvalue] 
			</td>
		</tr>
		[/if] [else:lasso_currentAction == 'delete'] [if:recID_value != -1] 
		<tr>
			<th>
				Record ID: 
			</th>
			<td class="code">
				[recID_value] 
			</td>
		</tr>
		[/if] [if:keyfield_name != ''] 
		<tr>
			<th>
				Primary Key: 
			</th>
			<td class="code">
				[keyfield_name][if:keyfield_value != ''] is &quot;[keyfield_value]&quot;[/if] 
			</td>
		</tr>
		[/if] [/if] 
		<tr>
			<th>
				Lasso Site: 
			</th>
			<td class="code">
				[site_name] ([site_id]) 
			</td>
		</tr>
		<tr>
			<th>
				Client Address: 
			</th>
			<td class="code">
				[_client_address_old] 
			</td>
		</tr>
		<tr>
			<th>
				Client IP: 
			</th>
			<td class="code">
				[_client_IP_old] 
			</td>
		</tr>
		<tr>
			<th>
				Client Type: 
			</th>
			<td class="code">
				[client_type] 
			</td>
		</tr>
		<tr>
			<th>
				Server Date: 
			</th>
			<td class="code">
				[server_date: -long] 
			</td>
		</tr>
		<tr>
			<th>
				Server Time: 
			</th>
			<td class="code">
				[server_time: -long] 
			</td>
		</tr>
		[ /if; ] 
	</table>
	[$show_admin_content ? $admin_content] 
</div>

			</div>
	</body>
</html>
